/*
 * Copyright 2012-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.webapp.bean;

import java.util.Date;


/**
 * Book bean.
 * 
 * @author Edwin Xico
 */
public class Book {

    private Integer id = null;
    private String book = null;
    private String autor = null;
    private String editorial = null;
    private String isbn = null;
    private Date created = null;
    
    /**
     * Gets id (primary key).
     */
    public Integer getId() {
        return id;
    }

    /**
     * Sets id (primary key).
     */
    public void setId(Integer id) {
        this.id = id;
    }
    
    /**
     * Gets book.
     */
	public String getBook() {
		return book;
	}

    /**
     * Sets book.
     */
	public void setBook(String book) {
		this.book = book;
	}

    /**
     * Gets autor.
     */
	public String getAutor() {
		return autor;
	}

    /**
     * Sets autor.
     */
	public void setAutor(String autor) {
		this.autor = autor;
	}

    /**
     * Gets editorial.
     */
	public String getEditorial() {
		return editorial;
	}

    /**
     * Sets editorial.
     */
	public void setEditorial(String editorial) {
		this.editorial = editorial;
	}

    /**
     * Gets zip or postal code.
     */
	public String getIsbn() {
		return isbn;
	}

    /**
     * Sets zip or postal code.
     */
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

    /**
     * Gets date created.
     */
	public Date getCreated() {
		return created;
	}

    /**
     * Sets date created.
     */
	public void setCreated(Date created) {
		this.created = created;
	}
	
    /**
     * Returns a string representation of the object. 
     */
	@Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        
        sb.append(this.getClass().getName() + "-");
        sb.append("  id=" + id);
        sb.append("  book=" + book);
        sb.append("  autor=" + autor);
        sb.append("  editorial=" + editorial);
        sb.append("  isbn=" + isbn);
        sb.append("  created=" + created);
        
        return sb.toString();
    }

    /**
     * Returns a hash code value for the object.
     */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((book == null) ? 0 : book.hashCode());
		result = prime * result + ((autor == null) ? 0 : autor.hashCode());
		result = prime * result + ((created == null) ? 0 : created.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((editorial == null) ? 0 : editorial.hashCode());
		result = prime * result
				+ ((isbn == null) ? 0 : isbn.hashCode());
		return result;
	}

	/**
	 * Indicates whether some other object is equal to this one.
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Book other = (Book) obj;
		if (book == null) {
			if (other.book != null)
				return false;
		} else if (!book.equals(other.book))
			return false;
		if (autor == null) {
			if (other.autor != null)
				return false;
		} else if (!autor.equals(other.autor))
			return false;
		if (created == null) {
			if (other.created != null)
				return false;
		} else if (!created.equals(other.created))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (editorial == null) {
			if (other.editorial != null)
				return false;
		} else if (!editorial.equals(other.editorial))
			return false;
		if (isbn == null) {
			if (other.isbn != null)
				return false;
		} else if (!isbn.equals(other.isbn))
			return false;
		return true;
	}

}
